<template>
	<div>
		<div>
			<el-alert title="截止提交后的一天为评审时间,评审结束后可查看成绩" type="success">
			</el-alert>
		</div>
		<el-table :data="myWorks" stripe style="width: 100%">
			<el-table-column prop="worksName" label="作品名称" fixed width="150">
			</el-table-column>
			<el-table-column prop="users.username" label="作者名" width="130">
			</el-table-column>
			<el-table-column prop="createTime" label="提交时间" width="230">
			</el-table-column>
			<el-table-column prop="checkEnd" label="评审进程" width="230">
			</el-table-column>
			<el-table-column prop="averageScore" label="平均得分" width="100">
			</el-table-column>
			<el-table-column prop="totalScore" label="总分" width="100">
			</el-table-column>
			<el-table-column label="所属分组" prop="group.groupName" width="150">
			</el-table-column>
			<el-table-column prop="competition.cname" label="比赛名称" width="180">
			</el-table-column>
			<el-table-column label="操作" fixed="right" width="250">
				<template slot-scope="scope">

					<el-button size="mini" :type="scope.row.checkEnd == '已结束'? 'success':'infor'" @click="lookWorksDetail(scope.$index, scope.row)">查看详情</el-button>
				</template>
			</el-table-column>
		</el-table>
		<el-dialog title="作品详情" :visible.sync="dialogFormVisible">
			<el-form :model="works">
				<el-form-item label="作品名称" :label-width="formLabelWidth">
					<el-input v-model="works.worksName" :disabled="true" autocomplete="off"></el-input>
				</el-form-item>
				<el-form-item label="行业调研分析" :label-width="formLabelWidth">
					<el-input v-model="works.industryAnalysis" type="textarea" :rows="6" :disabled="true" autocomplete="off"></el-input>
				</el-form-item>

				<div style="display: flex; align-items: center; justify-content: center;  flex-wrap:wrap ;">
					<template v-for="item in works.images">
						<el-image :src="item.photo" style="width: 1000px; height: 650px; border-radius: 10px; margin: 5px;" />
						</el-image>
					</template>
				</div>

			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="dialogFormVisible = false">取 消</el-button>

			</div>
		</el-dialog>

	</div>
</template>

<script>
	export default {
		name: "Query",
		data() {
			return {
				myWorks: [],
				user: JSON.parse(window.sessionStorage.getItem("user")),
				value: "",
				dialogFormVisible: false,
				formLabelWidth: "100px",
				works: {},
				active: 1
			}
		},
		mounted() {
			this.initMyWorks();
		},
		methods: {
			getWorkDetail() {
				this.getRequest("/works/detail/?id=" + this.works.id).then(res => {
					if (res) {
						console.log(res);
						this.works = res.obj;
					}
				})
			},
			lookWorksDetail(index, data) {
				this.works.id = data.id;
				this.getWorkDetail();
				this.dialogFormVisible = true;

			},
			initMyWorks() {
				this.getRequest("/works/myworks/?userId=" + this.user.id).then(res => {
					
					if (res) {
						this.myWorks = res.obj;
						// if (res.obj[0].level == 0 ) {
						// 	this.value = "谢谢参与"
						// } else if (res.obj[0].level == 2) {
						// 	this.value = "谢谢参与";
						// } else if (res.obj[0].level == 3) {
						// 	this.value = "三等奖";
						// } else if (res.obj[0].level == 4) {
						// 	this.value = "二等奖";
						// } else if (res.obj[0].level == 5) {
							this.level = "等待管理员确认";
						// }

					}
				})
			}
		},
	}
</script>

<style>
</style>
